home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1999 / MacHack 1999.toast / The Hacks / LiveFastStartServer / Open Transport 1.3 / Includes / CIncludes / OpenTptXTI.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-30  |  5.6 KB  |  209 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        OpenTptXTI.h
  3.  
  4.     Contains:    Prototypes for XTI-compatible routines for
  5.                 Open Transport
  6.  
  7.  
  8.  
  9. */
  10.  
  11. #ifndef __OPENTPTXTI__
  12. #define __OPENTPTXTI__
  13.  
  14. #ifndef __OPENTRANSPORT__
  15. #include <OpenTransport.h>
  16. #endif
  17.     
  18. #if PRAGMA_ALIGN_SUPPORTED
  19. #pragma options align=mac68k
  20. #endif
  21. #if PRAGMA_IMPORT_SUPPORTED
  22. #pragma import on
  23. #endif
  24.  
  25. /*******************************************************************************
  26. ** Global Variables
  27. ********************************************************************************/
  28.                     
  29. extern int    t_errno;
  30.  
  31. /*******************************************************************************
  32. ** Structures
  33. **
  34. ** WARNING: These structures will only work if "int"s are the
  35. **            same size as "size_t", "long", and "UInt32"
  36. ********************************************************************************/
  37.  
  38. struct netbuf
  39. {
  40.     unsigned int    maxlen;
  41.     unsigned int    len;
  42.     char*            buf;
  43. };
  44.  
  45. struct t_bind 
  46. {
  47.     struct netbuf        addr;
  48.     unsigned            qlen;
  49. };
  50.  
  51. struct t_optmgmt 
  52. {
  53.     struct netbuf    opt;
  54.     long            flags;
  55. };
  56.  
  57. struct t_discon 
  58. {
  59.     struct netbuf    udata;
  60.     int             reason;
  61.     int             sequence;
  62. };
  63.  
  64. struct t_call 
  65. {
  66.     struct netbuf    addr;
  67.     struct netbuf    opt;
  68.     struct netbuf    udata;
  69.     int             sequence;
  70. };
  71.  
  72. struct t_unitdata 
  73. {
  74.     struct netbuf    addr;
  75.     struct netbuf    opt;
  76.     struct netbuf    udata;
  77. };
  78.  
  79. struct t_uderr 
  80. {
  81.     struct netbuf    addr;
  82.     struct netbuf    opt;
  83.     long            error;
  84. };
  85.  
  86. /*    -------------------------------------------------------------------------
  87.     Transaction data structures
  88.     ------------------------------------------------------------------------- */
  89.  
  90. struct t_request        
  91. {
  92.     struct netbuf    data;
  93.     struct netbuf    opt;
  94.     long            sequence;
  95. };
  96.  
  97. struct t_reply        
  98. {
  99.     struct netbuf    data;
  100.     struct netbuf    opt;
  101.     long            sequence;
  102. };
  103.  
  104. struct t_unitrequest
  105. {
  106.     struct netbuf    addr;
  107.     struct netbuf    opt;
  108.     struct netbuf    udata;
  109.     long            sequence;
  110. };
  111.  
  112. struct t_unitreply
  113. {
  114.     struct netbuf    opt;
  115.     struct netbuf    udata;
  116.     long            sequence;
  117. };
  118.  
  119. struct t_opthdr
  120. {
  121.     unsigned long    len;        /* total length of option = sizeof(struct t_opthdr) +    */
  122.                                 /*                        length of option value in bytes    */
  123.     unsigned long    level;        /* protocol affected */
  124.     unsigned long    name;        /* option name */
  125.     unsigned long    status;        /* status value */
  126.                                 /* followed by the option value */
  127. };
  128.  
  129.  
  130. /*******************************************************************************
  131. ** XTI Interfaces
  132. ********************************************************************************/
  133.  
  134. #ifdef __cplusplus
  135. extern "C" {
  136. #endif
  137.  
  138. extern pascal int     t_accept(int fd, int resfd, struct t_call* call);
  139. extern pascal char* t_alloc(int fd, int struct_type, int fields);
  140. extern pascal int     t_bind(int fd, struct t_bind* req, struct t_bind* ret);
  141. extern pascal int     t_close(int fd);
  142. extern pascal int     t_connect(int fd, struct t_call* sndcall, struct t_call* rcvcall);
  143. extern pascal int     t_free(char* ptr, int struct_type);
  144. extern pascal int     t_getinfo(int fd, struct t_info* info);
  145. extern pascal int     t_getstate(int fd);
  146. extern pascal int     t_listen(int fd, struct t_call* call);
  147. extern pascal int     t_look(int fd);
  148. extern pascal int     t_open(char* path, int oflag, struct t_info* info);
  149. extern pascal int    t_blocking(int fd);
  150. extern pascal int    t_nonblocking(int fd);
  151. extern pascal int     t_optmgmt(int fd, struct t_optmgmt* req, struct t_optmgmt* ret);
  152. extern pascal int     t_rcv(int fd, char* buf, size_t nbytes, int* flags);
  153. extern pascal int     t_rcvconnect(int fd, struct t_call* call);
  154. extern pascal int     t_rcvdis(int fd, struct t_discon* discon);
  155. extern pascal int     t_rcvrel(int fd);
  156. extern pascal int     t_rcvudata(int fd, struct t_unitdata* unitdata, int* flags);
  157. extern pascal int     t_rcvuderr(int fd, struct t_uderr* uderr);
  158. extern pascal int     t_snd(int fd, char* buf, size_t nbytes, int flags);
  159. extern pascal int     t_snddis(int fd, struct t_call* call);
  160. extern pascal int     t_sndrel(int fd);
  161. extern pascal int     t_sndudata(int fd, struct t_unitdata* unitdata);
  162. extern pascal int     t_sync(int fd);
  163. extern pascal int     t_unbind(int fd);
  164. extern pascal int     t_error(char* errmsg);
  165. extern pascal int     t_getprotaddr(int fd, struct t_bind* boundaddr, struct t_bind* peeraddr);
  166. //
  167. // Apple extensions
  168. //
  169. extern pascal int    t_isnonblocking(int fd);
  170. extern pascal int    t_asynchronous(int fd);
  171. extern pascal int    t_synchronous(int fd);
  172. extern pascal int    t_issynchronous(int fd);
  173. extern pascal int    t_usesyncidleevents(int fd, int useEvents);
  174. /*
  175. ** Not XTI standard functions, but extensions for transaction endpoints    
  176. */
  177. extern pascal int    t_sndrequest(int fd, struct t_request*, int flags);
  178. extern pascal int    t_rcvreply(int fd, struct t_reply*, int* flags);
  179. extern pascal int    t_rcvrequest(int fd, struct t_request*, int* flags);
  180. extern pascal int    t_sndreply(int fd, struct t_reply*, int flags);
  181. extern pascal int    t_cancelrequest(int fd, long sequence);
  182. extern pascal int    t_cancelreply(int fd, long sequence);
  183.  
  184. extern pascal int    t_sndurequest(int fd, struct t_unitrequest*, int flags);
  185. extern pascal int    t_rcvureply(int fd, struct t_unitreply*, int* flags);
  186. extern pascal int    t_rcvurequest(int fd, struct t_unitrequest*, int* flags);
  187. extern pascal int    t_sndureply(int fd, struct t_unitreply*, int flags);
  188. extern pascal int    t_cancelurequest(int fd, long sequence);
  189. extern pascal int    t_cancelureply(int fd, long sequence);
  190.  
  191. extern pascal int    t_resolveaddr(int fd, struct t_bind* reqAddr, struct t_bind* retAddr, OTTimeout timeout);
  192. extern pascal int    t_cancelsynchronouscalls(int fd);
  193. extern pascal int    t_installnotifier(int fd, OTNotifyProcPtr proc, void* contextPtr);
  194. extern pascal void    t_removenotifier(int fd);
  195.  
  196. #ifdef __cplusplus
  197. }
  198. #endif
  199.  
  200. #if PRAGMA_ALIGN_SUPPORTED
  201. #pragma options align=reset
  202. #endif
  203. #if PRAGMA_IMPORT_SUPPORTED
  204. #pragma import off
  205. #endif
  206.  
  207. #endif    /* __OPENTRANSPORT__ */
  208.  
  209.